home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
751-760
/
760
/
s-text
/
s-text.doc
< prev
next >
Wrap
Text File
|
1995-03-18
|
6KB
|
149 lines
S - TEXT V1.1
Self-Displaying Text
Normally to read a text you call "Type <File>" at a CLI - whereupon the
start of it promptly scrolls off the screen - or you can dig out a text
reader or editor and load the file into it (the new WorkBench Ed is handy).
Calling from Workbench the icon for the text file must raise a suitable
reader. No problem in any of this.
But would it not be better to do away with the separate reader, use
compressed texts to save space and have the text start up an internal
reader and display itself.
Programmes such as
T3E
and
Txt2Exe
go part of
the way, they can be executed from a CLI without using the command 'type',
however they write directly into the CLI, there is no way of moving around
in the text, they can't be started from WorkBench, they have never heard
of compression; in effect the only gain is that the word 'type' does not
have to be used. I suspect that such programs are not used very often.
So let us draw up a spec for a self-displaying text program:
It must be possible to produce the executable text without re-compiling.
It must display text in a reader having, as a minimum, the commands Page
Up, Page Down, Line Up, Line Down, Start of file, End of file, Quit.
The executable must be capable of being run from both WorkBench & CLI.
It must be possible to recover the original file unblemished.
Compression should be used where appropriate.
Size of the executable file must never be more than 1000 bytes greater
than the bare uncompressed text, and should normally be a lot smaller.
Escape codes for text color and style must be handled properly.
Hence S-Text
.
S-Text first adds a display header (994 bytes). Then it checks whether
the text is compressed (P-Compress format); if so adds a decompression
header (1005 bytes) as well, otherwise the file is compressed - a check
is made as to whether the gain is greater than the size of the
decompression header - if not the uncompressed version is used.
Decompression header is added where it is needed.
The original can be recovered by executing (displaying) the file and
saving it with the S key.
Small text files under about 2K will not be compressed and will end up
some 1K larger. Larger files will be compressed and if the original size
was more than about 4K the executable will be smaller than the original
in spite of the added headers.
Fine - but are there any real advantage over simple compressed text +
text reader?
Disk space: With good decompressing readers at upwards of 15K you
must have a fair number of texts on the disk before you beat the
S-Text files, and since the P-Compress compression used is a lot
more efficient than the commonly used PowerPacker, you may never
catch up!
Convenience: No fiddling around with icon Default Tools.
Portability: The text can be transferred anywhere without worrying
over whether a suitable reader is available, or changing icons.
Speed: At a CLI it is a lot quicker to type "S-Text.doc" than for
example "dh0:c/MuchMore S-text.doc"
Perhaps the real point is that it gives you a file that can be moved
from disk to disk without having to even consider whether suitable
decompressing readers are on them.
The obvious disadvantage lies in the limited facilities offered by the
header. It would be nice to include scrolling and search, but these
would cause an unaceptable blowout in size.
This version has a couple of limitations :
A 'RAW' window is used which comes with a WINDOWSIZING gadget that
can't be removed under V1.3. This limits the number of characters in a
line (width is limited to your screen size - normally 640) to 77 chars.
Beyond this the line will word-wrap.
Escape code characters in a line, although handled correctly, are
counted in the line's length and may cause early word-wrapping.
INSTRUCTIONS
Very very simple:
To create the text executable open a CLI and type:
S-Text <textfile> <outfile>
The <outfile> must be different from <textfile>, you cannot directly
replace texts with their executable offspring. It is a good idea to add
an extension (.se) to the outfile to distinguish it from a primitive
non- executable text.
For Workbench use provide the executable with a TOOL type icon.
To view the text treat the file just like any other executable:
At a CLI type the name, use RUN if you wish.
From Workbench double-click the icon.
When called an S-Text file will open a window matching your current screen
and display the first page of text (to avoid lines scrolling off it assumes
that a LACEd screen will be using a font of the size of Topaz11). It was
originally intended to use the named keys of the numeric pad, but the
arrival of the Amiga 600, which has no numeric pad, killed that, and the
ordinary number keys are used instead.
1 Page Up 2 Page Down
3 Line Up 4 Line Down
5 Top of File 6 End of File
To save the text in its original uncompressed form press S or s. A file
"Txt" will be opened in RAM:
To quit press Esc.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
S-Text is Freeware. It may be copied and distributed freely and used
without charge for non-commercial purposes. Authority for commercial
use should be obtained from the author below.
No responsibility can be accepted for any loss occasioned by use of the
programme.
Comments, suggestions, bug-reports all welcome.
Chas A. Wyndham,
1265 Canning Mills Road,
Roleystone,
WA 6111.
Australia